<!--
 * @Author: Wang WeiHao
 * @Date: 2024-04-15 17:35:58
 * @LastEditors: Wang WeiHao
 * @LastEditTime: 2024-05-08 11:42:00
 * @Description: 
 * @FilePath: \hmcs_map\src\views\spone\frontPage\yong\yong1.vue
-->
<template>
  <div class="w-100 h-100">

    <div class="w-100 h-90 d-flex">
      <div
        v-for="(item, index) in list"
        :key="index"
        :style="{ backgroundImage: 'url(' + item.img + ')' }"
        class="background-div"
      >
        <div
          style="
            width: 100%;
            height: 60%;
            text-align: center;
            text-shadow: 0px 0px 3px #5ce1ff;
            font-size: 28px;
            line-height: 100px;
          "
        >
          {{ data[index] }}
        </div>
        <div
          style="
            text-align: center;
            font-size: 20px;
            font-family: 'OPPOSans-Regular';
          "
        >
          {{ item.name }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import img1 from "@/assets/image/underGround/yong1.png";
import img2 from "@/assets/image/underGround/yong2.png";
import img3 from "@/assets/image/underGround/yong3.png";
const props = defineProps({
  selectValue: {
    type: Number,
    default: 2024,
  },
  echartsData: {
    type: Array,
    default: () => [],
  },
});

const list = ref([
  {
    name: "居住区",
    img: img1,
  },
  {
    name: "工业区",
    img: img2,
  },
  {
    name: "市政公共区",
    img: img3,
  },
]);
const data:any = ref([]);

const current = computed(() => {
  
  let data:any = [];
  try {
    data = props.echartsData[props.selectValue];
  } catch (error) {}

  return data;
});

watch(
  () => current.value,
  (val) => {
    console.log(val,'valval1');
    
    if (val) {
   data.value=val
    }
  }
);
onMounted(() => {
data.value=props.echartsData[props.selectValue]

});
</script>

<style>
.background-div {
  width: 100%; /* 或者其他所需宽度 */
  height: 100%; /* 为了看到背景图，需要设置一个高度 */
  background-position: center; /* 背景图片居中显示 */
  background-repeat: no-repeat; /* 背景图片不重复 */
}
</style>
